package com.lww.feature.test.design.pattern.component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: liweiwei
 * @date: 2019/1/23
 */
public class Composite implements Component {

    private List<Component> list = new ArrayList<>();
    @Override
    public void operation() {
        for (Component component : list) {
            component.operation();
        }
    }

    @Override
    public void add(Component c) {
        list.add(c);
    }

    @Override
    public void remove(Component c) {
        list.remove(c);
    }

    @Override
    public void getChild(int i) {

    }
}
